package cn.zcf.feignclient;

import cn.zcf.domain.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;

@FeignClient(name = "user-server",fallbackFactory = UserFallbackFactory.class) // 指定需要调用的服务的应用名称
@RequestMapping("/user")
public interface UserFeignClient {

    /*
     * @Description: OpenFeign调用user服务接口，默认底层会帮助我们创建动态代理实现类，会使用RestTemplate进行调用
     * @Author: Director
     * @Date: 2022/7/28 10:28
     * @param id:
     * @return: cn.itsource.domain.User
     **/
    @GetMapping("/getById/{id}")
    User getById(@PathVariable("id") Long id);

}